package com.jinlia.show.modules.base.model.po;


import com.jinlia.show.modules.base.system.entity.DeliveryOrder;
import com.jinlia.show.modules.base.system.entity.Order;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.function.Supplier;


@Data
public class OrderPO extends Order {
    /**
     * 关联的订单项
     */
    private List<OrderItemPO> items;

    /**
     * 关联的配送单
     * @param entity
     * @return
     */
    private DeliveryOrder deliveryOrder;
    public static OrderPO fromEntity(Order entity) {
        OrderPO entityVO = new OrderPO();
        BeanUtils.copyProperties(entity, entityVO);
        return entityVO;
    }


    public void filedVO(Supplier<String>... methodReference) {
        for (Supplier<String> stringSupplier : methodReference) {
            stringSupplier.get();
        }
    }
}
